<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        table {
            border: 1px solid black;
        }

        tr {
            border-bottom: 1px solid black;
        }

        td {
            border-bottom: 1px solid black;
        }

        .bgc {
            background-color: pink;
        }
    </style>
</head>

<body>
    <table>

        <thead>
            <tr>
                <th>代码</th>
                <th>名称</th>
                <th>净值</th>
                <th>增长率</th>
                <th>单位</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>asd </td>
                <td>sbaeqge</td>
                <td>adab</td>
                <td>abadad</td>
                <td>wsafeg</td>
            </tr>
            <tr>
                <td>12 </td>
                <td>23</td>
                <td>34</td>
                <td>45</td>
                <td>56</td>
            </tr>
            <tr>
                <td>13et </td>
                <td>231e1</td>
                <td>e1r23qeg</td>
                <td>12r</td>
                <td>12t3g</td>
            </tr>
            <tr>
                <td>asd </td>
                <td>3qg</td>
                <td>adab</td>
                <td>abadad</td>
                <td>13gq</td>
            </tr>
            <tr>
                <td>asd </td>
                <td>sbaeqge</td>
                <td>adab</td>
                <td>abadad</td>
                <td>wsafeg</td>
            </tr>
        </tbody>
    </table>
    <script>
        //获取tbody里面的所有行
        let tr = document.querySelector('tbody').querySelectorAll('tr');
        console.log('==>',tr);
        for (var i = 0; i < tr.length; i++) {
            tr[i].onmouseover = function () {
                this.className = 'bgc'
            }
            tr[i].onmouseout = function () {
                this.className = ''
            }

        }
    </script>
</body>

</html>